package routes

import (
	"go-web-mini/controller"
	"go-web-mini/middleware"

	jwt "github.com/appleboy/gin-jwt/v2"
	"github.com/gin-gonic/gin"
)

func InitTodoRoutes(r *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) gin.IRoutes {
	roleController := controller.NewTodoController()
	router := r.Group("/todo")
	// 开启jwt认证中间件
	router.Use(authMiddleware.MiddlewareFunc())
	// 开启casbin鉴权中间件
	router.Use(middleware.CasbinMiddleware())
	{
		router.GET("/list", roleController.GetList)
		// router.POST("/create", roleController.CreateRole)
		// router.PATCH("/update/:roleId", roleController.UpdateRoleById)
		// router.DELETE("/delete/batch", roleController.BatchDeleteRoleByIds)
	}
	return r
}
